package com.example.demo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.mapper.UserRoleMapper;
import com.example.demo.pojo.UserRole;
import com.example.demo.service.UserRoleService;
import org.springframework.stereotype.Service;

/**
* @author yangqi
* @description 针对表【db_user_role】的数据库操作Service实现
* @createDate 2024-01-18 14:16:16
*/
@Service
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole>
    implements UserRoleService {

    @Override
    public Long getRoleByUserID(Long userId) {
        UserRole one = lambdaQuery().select(UserRole::getRoleId).eq(UserRole::getUserId, userId).one();

        Long roleId = one.getRoleId();
        return roleId;
    }
}




